package com.ruoyi.system.api;

import com.ruoyi.common.core.constant.SecurityConstants;
import com.ruoyi.common.core.constant.ServiceNameConstants;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.system.api.domain.Attachment;
import com.ruoyi.system.api.domain.AttachmentVO;
import com.ruoyi.system.api.factory.RemoteAttachmentFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient(contextId = "remoteAttachmentService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteAttachmentFallbackFactory.class)
public interface RemoteAttachmentService {
    @PostMapping("/attachment")
    R<Integer> add(@RequestBody Attachment attachment);

    @PostMapping("/attachment/batchAdd")
    R<Integer> batchAdd(@RequestBody AttachmentVO vo, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    @PostMapping("/attachment/batchDeleteAttachment")
    R batchDeleteAttachment(@RequestBody List<Long> associatedIds, @RequestHeader(SecurityConstants.FROM_SOURCE)String source);

    @GetMapping(value = "/attachment/getPictureByAssociatedId/{associatedId}")
    R<List<Attachment>> getPictureByAssociatedId(@PathVariable("associatedId") Long associatedId, @RequestHeader(SecurityConstants.FROM_SOURCE)String source);
}
